<template>
  <div class="app-container">
    ssss
    <ReportForm :model-name="modelName" @changed="getData">
      //
    </ReportForm>
    <div>报表类型: {{ wizardData.account_report_id__name }}</div>
    <div>会计分录: {{ wizardData.target_move__name }}</div>
    <div>开始时间: {{ wizardData.date_from }}</div>
    <div>结束时间: {{ wizardData.date_to }}</div>

    <div>
      <el-table :data="data.get_account_lines" style="width: 100%">
        <el-table-column
          v-for="col in columns"
          :key="col.name"
          :prop="col.name"
          :label="col.label"
        />
      </el-table>
    </div>
  </div>
</template>

<script>
import odoo from '@/odooapi'

import ReportForm from '@/selfComponents/Report/ReportForm'

const modelName = 'Test/report_financial_pl'

export default {
  name: '',
  components: { ReportForm },
  directives: {},
  filters: {},

  data() {
    return {
      modelName: modelName,
      wizardData: {},
      data: [],
      columns: [
        { name: 'name', label: 'Name' },
        { name: 'type', label: 'type' },
        { name: 'account_type', label: 'account_type' },
        { name: 'level', label: 'level' },
        { name: 'debit', label: '借方' },
        { name: 'credit', label: '贷方' },
        { name: 'balance', label: '余额' }
      ]
    }
  },
  async created() {
    // const [model, id] = await odoo.ref(
    //   'accounting_pdf_reports.account_financial_report_balancesheet0'
    // )
    // // const action = await odoo.env(model).browse_one(id)
    // console.log('xxxxxx, action', model, id)
  },
  methods: {
    async getData(res) {
      console.log('xxxxxxx, detail data,', res)
      this.data = res
      this.wizardData = res.wizard_data
    }
  }
}
</script>
